//
//  ViewController.m
//  UI21_02_Block 实现页面间传值
//
//  Created by 李劲成 on 16/4/7.
//  Copyright © 2016年 ljc. All rights reserved.
//

#import "ViewController.h"
#import "VCOfSecond.h"
@interface ViewController ()

@property (weak, nonatomic) IBOutlet UILabel *Label;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

/** push 到下一个页面调用此方法. */
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // 获取末端界面.
     VCOfSecond *second = segue.destinationViewController;
    // block 实现.
    // block 实现体中, 对对象进行强引用, 避免循环引用, 修改为弱引用.
    // ARC 下, __weak 修饰词.
    // MRC 下, __block 修饰词.
    __weak typeof(self) weakself = self;
    
    second.handlerString = ^(NSString * str){
        weakself.Label.text = str;
    };
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
